<?php
$v=$_GET['value'];

$link=mysqli_connect("localhost",'root','','yf');
//设置编码
mysqli_set_charset($link,"utf8");

$sql="select id, name, price from yf_goods where name like'%$v%'";

$result=mysqli_query($link,$sql);

$ar1=[];


while($row=mysqli_fetch_assoc($result)){
    array_push($ar1,$row);

}
echo json_encode($ar1);

mysqli_close($link);
?>